package com.syx.migration.utils;

import com.syx.migration.service.MgnLinkIdService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author Administrator
 * @date 2024/6/7 8:56
 * @description: 学校工具类
 */
public class SchoolUtils {

    private static final MgnLinkIdService mgnLinkIdService = SpringUtils.getBean(MgnLinkIdService.class);

    private final static Map<String, String> schoolMap = new ConcurrentHashMap<>();

    /**
     * 根据belong获取租户id
     */
    public static String getTenantIdByBelong(String belong){
        if (schoolMap.isEmpty()){
            schoolMap.putAll(mgnLinkIdService.getMapByTbName("syx_school"));
        }
        return schoolMap.get(belong);
    }



}
